﻿package com.sxhalo.manage.service.impl;

import java.util.List;

import com.sxhalo.manage.dao.SysApplicationsDAO;
import com.sxhalo.manage.map.SysApplications;
import com.sxhalo.manage.service.IBaseService;
import com.sxhalo.manage.utils.Pager;

public class SysApplicationsServiceImpl implements
		IBaseService<SysApplications> {

	private SysApplicationsDAO myDao;

	public SysApplicationsDAO getMyDao() {
		return myDao;
	}

	public void setMyDao(SysApplicationsDAO myDao) {
		this.myDao = myDao;
	}

	@Override
	public void save(SysApplications entity) {
		myDao.save(entity);
	}

	@Override
	public void update(SysApplications entity) {
		myDao.merge(entity);
	}

	@Override
	public Boolean delete(SysApplications entity) {
		try {
			myDao.delete(entity);
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	@Override
	public Boolean delete(Integer id) {
		try {
			SysApplications entity = new SysApplications();
			entity.setAppId(id);
			myDao.delete(entity);
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	@Override
	public void service() {

	}

	@Override
	public SysApplications findById(Object id) {
		return myDao.findById(Integer.parseInt(id.toString()));
	}

	@Override
	public SysApplications find(String fieldName, Object fieldValue) {
		List<SysApplications> list = findList(fieldName, fieldValue);
		return list.size() > 0 ? list.get(0) : null;
	}

	@Override
	public List<SysApplications> findList(String fieldName, Object fieldValue) {
		return myDao.findByProperty(fieldName, fieldValue);
	}

	@Override
	public List<SysApplications> findAll() {
		return myDao.findAll();
	}

	@Override
	public List<SysApplications> findListByIds(List<String> idList) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Pager<SysApplications> findPagerList(int pageNumber, int pageSize,
			String whereStr, String orderStr) {
		return myDao.findPagerList(pageNumber, pageSize, whereStr);
	}

	@Override
	public List<SysApplications> findByExample(Object instance) {
		// TODO Auto-generated method stub
		return null;
	}
}
